Data Driven Testing using Excel-Part2

9,904 views9.9K views
Jul 2, 2017
62.8K subscribers
Subscribe
Selenium Materials & FAQ's: https://goo.gl/BosFNL Visit our blogs for more Tutorials & Online training ========================================== https://www.pavanonlinetrainings.com https://www.pavantestingtools.com https://pavanhadooptesting.blogspot.in/ Subscribe our YouTube Channel for getting updated videos ========================================== https://www.youtube.com/pavanoltraining Like us in Face book ========================================== https://www.facebook.com/pavanoltrain... https://www.facebook.com/seleniumtest... https://www.facebook.com/groups/pavan... Hadoop Testing Videos: ========================================== https://www.youtube.com/watch?v=Z6wSg... Java Videos ========================================== https://www.youtube.com/watch?v=sx9NN... Selenium Webdriver videos ========================================== https://www.youtube.com/watch?v=2yNo9... ETL Testing videos ========================================== https://www.youtube.com/watch?v=Vpx9-... Database Testing Videos ========================================== https://www.youtube.com/watch?v=QMfIZ... Automation Frameworks ========================================== https://www.youtube.com/watch?v=X3Grs... Agile Testing Videos ========================================== https://www.youtube.com/watch?v=S3Nrm... SQL Videos ========================================== https://www.youtube.com/watch?v=RtQze... DevOps videos ========================================== https://www.youtube.com/watch?v=zc5DE...
this is the best class for my studies.
Sir, I want to know how to take values from a particular row and columns with out seeing excel sheet not hardcoding values.
How to read perticularly one row from excel through selenium with java
excellent video on selenium that i came across so far in Internet. Thanks! sir. You really explained well.
WOW!!!!unbelievable stuff!!I have been battling with this for quite some time.You have made my day.Super Tuesday!!!!Thank you in advance.
Natural ability - you have a rare ability to break down complex topics into simple topic!!!!you are amazing.I have spend a lot of money and time on this but none could explain it the way you did especially for free!!!!God is great
So far the best video on data driven testing..thankq Soo much pavan sir
Sir,, how can I write a code for the list field which has input tag not the select tag,, I thought I can try with bootstrap, but the list field is like,,we have to search for the value and then select the value from the list,,do I have to write as like find the text box,sending the value,,then to click on search,then selecting the value,,,or is there any other approach??
Very nicely explained sir ..
Nice explanation with very good patience
public class RegistrationTest { public static FileOutputStream fos; public static FileInputStream fis; WebDriver driver; @Test public void browser() throws Exception { driver = new ChromeDriver(); driver.manage().window().maximize(); driver.get("http://www.newtours.demoaut.com/mercuryregister.php"); fis = new FileInputStream("D://book6.xlsx"); XSSFWorkbook workbook = new XSSFWorkbook(fis); XSSFSheet sheet = workbook.getSheet("sheet1"); int Row = sheet.getLastRowNum(); System.out.println("No of Record in the Excel Sheet:"+Row); for(int row =1;row<=Row;row++);{ XSSFRow current_row=sheet.getRow(Row); String Lastname = current_row.getCell(1).getStringCellValue(); String CompanyName = current_row.getCell(2).getStringCellValue(); String Note = current_row.getCell(3).getStringCellValue(); String State = current_row.getCell(4).getStringCellValue(); String City = current_row.getCell(5).getStringCellValue(); String Country = current_row.getCell(6).getStringCellValue(); String Email = current_row.getCell(7).getStringCellValue(); String Username = current_row.getCell(8).getStringCellValue(); String Password = current_row.getCell(9).getStringCellValue(); // Registration Process driver.findElement(By.linkText("Registration")).click(); driver.findElement(By.name("firstName")).sendKeys("Frist name"); driver.findElement(By.name("lastName")).sendKeys("Last name"); driver.findElement(By.name("phone")).sendKeys("phone"); driver.findElement(By.name("userName")).sendKeys("Email"); driver.findElement(By.name("address1")).sendKeys("Address"); driver.findElement(By.name("city")).sendKeys("City"); driver.findElement(By.name("state")).sendKeys("State"); driver.findElement(By.name("postalCode")).sendKeys("postalCode"); Select dropcountry = new Select(driver.findElement(By.name("country"))); dropcountry.selectByVisibleText("country"); driver.findElement(By.name("email")).sendKeys("username"); driver.findElement(By.name("password")).sendKeys("Password"); driver.findElement(By.name("confirmPassword")).sendKeys("Password"); driver.findElement(By.name("register")).click(); if(driver.getPageSource().contains("Thank for registering")) { System.out.println("Registration Completed for " + Row + " record"); } else { System.out.println("Registration Completed for " + Row + " record"); } } } } No of Record in the Excel Sheet:6 FAILED: browser java.lang.IllegalStateException: Cannot get a numeric value from a text cell at org.apache.poi.xssf.usermodel.XSSFCell.typeMismatch(XSSFCell.java:845) at org.apache.poi.xssf.usermodel.XSSFCell.getNumericCellValue(XSSFCell.java:208) at project600.project600.ReadExcel3.browser(ReadExcel3.java:33) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124) at org.testng.internal.Invoker.invokeMethod(Invoker.java:583) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:719) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:989) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109) at org.testng.TestRunner.privateRun(TestRunner.java:648) at org.testng.TestRunner.run(TestRunner.java:505) at org.testng.SuiteRunner.runTest(SuiteRunner.java:455) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415) at org.testng.SuiteRunner.run(SuiteRunner.java:364) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1208) at org.testng.TestNG.runSuitesLocally(TestNG.java:1137) at org.testng.TestNG.runSuites(TestNG.java:1049) at org.testng.TestNG.run(TestNG.java:1017) at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77) =============================================== Default test Tests run: 1, Failures: 1, Skips: 0 ===============================================
String Phone=currentrow.getCell(2).getStringCellValue(); String Postcode=currentrow.getCell(7).getStringCellValue(); When i put String value for phone and postcode, the console gives ans error " Exception in thread "main" java.lang.IllegalStateException: Cannot get a STRING value from a NUMERIC cell". Can you please provide solution?
1

Selenium Automation Online Training Demo on 24-May-2018

SDET
2

Overview on Automation Testing & Selenium

SDET
3

Introduction to Selenium WebDriver

SDET
4

WebDriver configuration with Eclipse

SDET
5

Automate test case using WebDriver

SDET
6

Headless Browser Testing in Selenium with Java

SDET
7

Selenium WebDriver Get Methods

SDET
8

Locators In Selenium Part I

SDET
9

Locators In Selenium Part II

SDET
10

Data Driven Test using Excel-Part1

SDET

Data Driven Testing using Excel-Part2

SDET
12

Selenium Webdriver Handling Web Table

SDET
13

How to Check Drop down options are sorted or not in selenium with Java

SDET
14

Selenium Webdriver Handling Browser Windows

SDET
15

How to Handle Authentication Popup in Selenium Web Driver

SDET
16

Selenium Webdriver Handling IFrames

SDET
17

Actions Class in WebDriver

SDET
18

How to find Broken links using Selenium WebDriver

SDET
19

Download Files in Chrome & Firefox using Web Driver

SDET
20

Upload & Download Files in Selenium using Sikuli

SDET
21

Download Files using Selenium

SDET
22

Robot Class in Selenium WebDriver || Handle Keyboard Events in Selenium

SDET
24

Upload Files using AutoIT

SDET
25

Handling Cookies in Selenium Part-1

SDET
26

Handling Cookies in Selenium Part-2

SDET
27

Scrolling Web Page using Selenium WebDriver

SDET
28

Scrolling Web Page using Selenium WebDriver

SDET
29

JavaScriptExecutor in Selenium with Java | Execute JavaScript code using Selenium

SDET
30

How to Encode Password in Selenium using Java || Password Encryption in Java

SDET
31

How to compare Images in Selenium using AShot API || Working with AShot API

SDET
32

How to automate BarCode using ZXing API in Selenium

SDET
33

How to automate QRCode using ZXing API in Selenium

SDET
34

WebDriver Test case with MicroSoft Edge Browser

SDET
35

Database Testing using Selenium

SDET
36

Page Object Model & Log4J

SDET
37

How to use HashMap in Selenium

SDET
38

TestNG Assertions

SDET
39

TestNG Batch Testing

SDET
40

TestNG Listeners & Extent Reports

SDET
41

Working with Selenium Grid on Windows & Linux Platforms

SDET
42

GIT, GITHUB & CI

SDET
43

Eclipse plug-in for GIT & GitHub

SDET
44

Selenium FAQ'S Part1

SDET
45

Selenium FAQ'S Part2

SDET
46

Selenium FAQ'S Part-3

SDET
47

Selenium Demo Session on 02-June-2018

SDET
48

Selenium Training Demo

SDET
49

How to Record Selenium Test Execution Video || Monte Screen Recorder API

SDET
50

Extent Report Version 4 || Generate Extent Reports in Selenium

SDET
51

How to Handle Stale Element Exception in Selenium with Java

SDET
52

XPath Functions and Axes Methods||Ancestor,Child,Parent,Preceding,Following,Self & Descendant

SDET
53

How to automate Google search in Selenium with Java

SDET
54

How to Automate Date Pickers in Selenium using Java

SDET
55

Hierarchy of Selenium Classes and Interfaces

SDET
56

Part1-How To Generate Allure Reports in Selenium & TestNG

SDET
57

Part2-How To Generate Allure Reports in Selenium & TestNG

SDET